package icegps.com.pingdj.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import icegps.com.pingdj.R;

/**
 * Created by 111 on 2018/3/16.
 */

public class BottomDialog extends Dialog {

    public BottomDialog(@NonNull Context context) {
        super(context, R.style.ActionSheetDialogStyle);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.ActionSheetDialogAnimation); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes(); // 获取对话框当前的参数值
        lp.width = getContext().getResources().getDisplayMetrics().widthPixels; // 宽度
        window.setAttributes(lp);
    }
}
